
package com.hua.api.core.util;

import com.hua.api.core.framework.util.exception.ApiError;

/**
 * 验证工具
 *
 */
public class ValidationUtil {


    public static void requireNotNull(Object obj, String errMsg){
        if(StringUtil.isEmpty(obj)){
            throw ApiError.Type.ENTITY_ERROR.toException(errMsg);
        }
    }

    public static void requireNotNull(Object obj, String entity, String parameter , Object value){
        if(StringUtil.isEmpty(obj)){
            String msg = entity + " 不存在: "+ parameter +" is "+ value;
            throw ApiError.Type.ENTITY_ERROR.toException(msg);
        }
    }
}
